package com.hex.liyue.guidemodule.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.hex.liyue.R;
import com.hex.liyue.commonmodule.activity.BaseActivity;
import com.hex.liyue.commonmodule.utils.StatusBarCompatUtils;
import com.hex.liyue.guidemodule.presenter.ISplashView;
import com.hex.liyue.guidemodule.presenter.SplashPresenter;
import com.hex.liyue.mainmodule.activity.MainActivity;
import com.hex.liyue.usermodule.activity.LoginAndRegistActivity;

import butterknife.Bind;

public class SplashActivity extends BaseActivity implements ISplashView {

    @Bind(R.id.iv_splash_bg)
    ImageView ivSplashBg;
    private SplashPresenter splashPresenter;
    private Intent intent;
    @Override
    protected void bindPresenter() {
        splashPresenter = new SplashPresenter(this);
    }
    @Override
    protected void initData(Bundle extras) {
        Glide.with(this).load(R.drawable.splash_bg).into(ivSplashBg);
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                splashPresenter.jump();
            }
        },3000);
    }

    @Override
    public int getContentLayout() {
        return R.layout.activity_splash;
    }

    @Override
    protected void initToolbar() {
        StatusBarCompatUtils.compat(this);
    }

    @Override
    public void startMainActivity() {
        intent = new Intent(this, MainActivity.class);
        startActivity(intent);
        finish();
    }

    @Override
    public void startLoginAndRegistActivity() {
        intent = new Intent(this, LoginAndRegistActivity.class);
        startActivity(intent);
        finish();
    }

    @Override
    public void startGuideActivity() {
        intent = new Intent(this, GuideActivity.class);
        startActivity(intent);
        finish();
    }

}
